package chixing.day14.homework.work1;

public class ProductCarTest {
    public static void main(String[] args) {
        Car car = new Car();
        Product product1 = new Product(1, "手机", 888);
        Product product2 = new Product(2, "电脑", 222);
        Product product3 = new Product(3, "空调", 333);
        Product product4 = new Product(4, "电视", 444);
        //添加
        car.add(product1);
        car.add(product2);
        car.add(product3);
        car.add(product4);
        //遍历
        System.out.println("-------遍历---------");
        car.display();
        //根据下标获得
        System.out.println("-------根据下标获得---------");
        System.out.println(car.get(1));
        //根据商品名称获得
        System.out.println("-------根据商品名称获得---------");
        System.out.println(car.get("空调"));
        //删除
        System.out.println("-------删除---------");
        System.out.println(car.remove(0));
    }
}
